/*
 * DiscoverySearchAccurateActivity.java
 * business
 *
 * Created by chentao on 2017/4/21.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.main.discovery.searchaccurate;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.data.model.DiscoverySearchModel;
import com.yidiandao.business.data.recyclertype.AccurateContent;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * 发现-精确搜索-Activity.
 */
public class DiscoverySearchAccurateActivity extends BaseActivity {

    private DiscoverySearchAccurateFragment mSearchAccurateFragment;

    public static void actionStart(Activity activity, AccurateContent accurateContent) {
        Intent intent = new Intent(activity, DiscoverySearchAccurateActivity.class);
        intent.putExtra(Intents.ACCURATE_CONTENT, accurateContent);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mSearchAccurateFragment = (DiscoverySearchAccurateFragment) getSupportFragmentManager().findFragmentById(R.id.container_discovery_search_accurate);

        if (mSearchAccurateFragment == null) {
            mSearchAccurateFragment = DiscoverySearchAccurateFragment.getInstance();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), mSearchAccurateFragment, R.id.container_discovery_search_accurate);
        }

    }

    @Override
    protected void initPresenter() {
        AccurateContent accurateContent = getIntent().getExtras().getParcelable(Intents.ACCURATE_CONTENT);
        new DiscoverySearchAccuratePresenter(mSearchAccurateFragment, accurateContent, new DiscoverySearchModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_discovery_search_accurate;
    }
}
